function Notice_Code() {
	var buffer = new StringBuffer();
	buffer.append('<div class="title"><div class="back"></div><div class="name">消息</div><div class="tool"></div></div>');
	buffer.append('<div class="sign border-bottom">');
	buffer.append('<div class="sign_state"><div id="sign_quan" class="sign_quan">未签到<br><font>--</font></div></div>');
	buffer.append('<div class="sign_time"><div class="time1">上班时间</div><div class="time2">'+Get_SignTime(User.SignRule)+'</div></div>'); 
	buffer.append('<div class="sign_checkin"><div class="shadow"></div><img id="checkin" src="img/sign.png"/></div>');
	buffer.append('<div class="sign_position"><div class="pos"><img src="img/position.jpg"/></div><div id="address" class="address"></div><div class="reflash"><!--<img src="img/reflash.jpg"/>--></div></div>');
	buffer.append('</div>');
	buffer.append('<div id="content" class="content" >');
	buffer.append('<ul id="often5" ids="" rids="" pids="" tableid="5" >');
	buffer.append('<li tablename=""><div class="line border-bottom"><div class="icon"><img src="img/notice.png"></div><div class="name">公告</div><div class="detail">这里是您的所有公告</div><div class="date"></div></div></li>');
	//buffer.append('<div class="loading"><img src="img/loading.gif"/></div>');
	buffer.append('</ul>');
	buffer.append('</div>');
	return buffer.toString();
};

function Notice_Data1(data)
{
	var buffer = new StringBuffer();
	var count=0;
	$.each(data,function(i,info){
		try{
		info.Context=decodeURI(info.Context);
		}catch(e){}
		buffer.append('<li id="'+info.Ids+'" ids="'+info.Ids+'" rids="'+info.RIds+'" pids="'+info.PIds+'" dids="'+info.Ids+'" tableid="'+info.TableID+'" tablename="'+info.TableName+'"><div class="line border-bottom"><div class="icon"><img src="img/'+Get_ICON(info.TableID)+'">');
		if(info.Count>0)
		{
			buffer.append('<span>'+info.Count+'</span>');
			count+=info.Count;
		}
		buffer.append('</div><div class="name">'+info.TableName+'</div><div class="detail">'+info.Context+'</div><div class="date">'+info.Date+'</div></div></li>');
	});
	plus.runtime.setBadgeNumber(count);
	if(count==0)
	{
		$("#noticecount").attr("class","hidden");
		$("#noticecount").html("");
	}else
	{
		$("#noticecount").removeClass("hidden");
		$("#noticecount").html(count);
	}
	return buffer.toString();
};
var myScroll1;
function Init_NoticeClick() {
	$("#content li").each(function(i, info) {
		info.addEventListener("tap", function() {
			var tablename=$(info).attr("tablename");
			var tableid=$(info).attr("tableid");
			if(tableid=="1" || tableid=="2" || tableid=="3" || tableid=="4" || tableid=="5" || tableid=="37")
			{
				if(tablename=="公告")
				{
					tablename+="列表";
				}else
				{
					tablename+="提醒";
				}
				var tool="";
				if(User.RolePower.indexOf(",5,")>-1 && tableid=="5")
				{
					tool="<font>+</font>";
				}
				myScroll1 = OpenScroll(1,tablename,tool,function(pageindex){
					Receive_Data(info,pageindex);
				},function(){
					touserid="";todepartid="";tocomid="";
					OpenWindow(2,"发布公告","保存",function(){
						Publish_Submit(5);
					});
					$("#contentlist2").html(Publish_Data(5));
					Init_Publish(5);
				});
				if(tablename=="日志提醒" || tablename=="任务提醒" || tablename=="审批提醒")
				{
					var data = {};
					data.act = "Get_NoHandle";
					data.ids=$(info).attr("ids");
					data.userid=userid;
					data.comid=comid;
					data.tableid=tableid;
					data.source=source;
					data.sign=GetSign(data.act);
					var ids=","+data.ids+",";
					
					mui.getJSON(index_domain, data, function(json){
						$.each(json.data.nohandle,function(i,id){
							ids = ids.replace(","+id+",",",");
						});
						$(info).attr("dids",ids);
						if($(info).find("span").length>0 && (tableid==2 || tableid==3 || tableid==4))
						{
							var nowcount=parseInt($("#noticecount").html())-parseInt($(info).find("span").html())+json.data.nohandle.length;
							$(info).find("span").html(json.data.nohandle.length);
							
							if(json.data.nohandle.length==0){
								$(info).remove();
							}
							if(nowcount>0)
							{
								$("#noticecount").html(nowcount);
							}else{
								$("#noticecount").html("");
								$("#noticecount").attr("class","hidden");
							}
							plus.runtime.setBadgeNumber(nowcount);
						}
						Receive_Data(info,1);
						$(info).attr("ids",json.data.nohandle.join(","));
					});
				}else
				{
					Receive_Data(info,1);
				}
			}
			if(tableid=="12")
			{
				myScroll1 = OpenScroll(1,"订单列表","",function(pageindex){
										Receive_Order(pageindex,null,null,info);
							},function(){ 
								},Order_Code(),70);
								//$("#contentlist2").append(Publish_Code());
								Receive_Order(1,null,null,info); 
								Init_Order_Code();
			}
			if(tablename=="今日待回访客户")
			{
				myScroll1 = OpenScroll(1,"今日待回访客户","",function(pageindex){
										Receive_Customer(pageindex);
								},function(){
									
								},Customer_Code(),70);
								//$("#contentlist2").append(Publish_Code());
								Receive_Customer(1,$(info).attr("ids"));
								Init_Customer_Code();
			}
			if(tablename=="客户回访提醒")
			{
				OpenWindow2(2,"客户详情","操作",function(){
					CustomerTool();
				});
				obj=$(this);
				$("#contentlist2").html(CustomerInfo_Code());
				get("contentlist2").addEventListener("tap",function(){
					if($(".customertool").length>0)
					{
						$(".customertool").hide();
					}
				});
				Init_CustomerInfo();
				SaleRecord_HasRead($(info).attr("rids"));
			}
			if($(info).find("span").length>0 && tablename!="今日待回访客户" && tablename!="日志提醒" && tablename!="任务提醒" && tablename!="审批提醒")
			{
				var nowcount=parseInt($("#noticecount").html())-parseInt($(info).find("span").html());
				$(info).remove();
				if(nowcount>0)
				{
					$("#noticecount").html(nowcount);
				}else{
					$("#noticecount").html("");
					$("#noticecount").attr("class","hidden");
				}
				plus.runtime.setBadgeNumber(nowcount);
			}
		});
	});
};

function SaleRecord_HasRead(id){
	var data = {};
	data.act = "SaleRecord_HasRead";
	data.id=id;
	data.userid=userid;
	data.comid=comid;
	data.source=source;
	data.sign=GetSign(data.act);
	
	mui.getJSON(crm_domain, data, function(json) {
	});
};

function Data_Search(tableid){
	pageindex=1;
	$("#divmsg1").attr("pageindex","0");
	var info=get("often"+tableid);
	Receive_Data(info,1);
};

function Receive_Data(info,pageindex,minout,mbegindate,menddate)
{
			var inout=RUndefined($(".searchtab .select").attr("val"));if(minout){inout=minout;}
			var lowers=RUndefined($("#users_search").attr("touserid"));
			var data = {};
			data.inout="all";
			data.tableid = $(info).attr("tableid");
			data.begindate = RUndefined($("#begindate_search").val());if(mbegindate){data.begindate=mbegindate;}
			data.enddate = RUndefined($("#enddate_search").val());if(menddate){data.enddate=menddate;}
			data.keyword = RUndefined($("#keyword_search").val());
			if(data.tableid==1)
			{
				data.act = "Find_Share";
			    data.lowers = lowers==""?"0":lowers;
			    data.inout = inout==""?"all":inout;
			} 
			if(data.tableid==2)
			{
				var state = RUndefined($("#state_search").val());
				data.act = "Find_Daily";
			    data.lowers = lowers==""?"0":lowers;
			    data.inout = inout==""?"all":inout;
			    data.state=state==""?"-1":state;
			    data.type=-1;
			}
			if(data.tableid==3)
			{
				var state = RUndefined($("#state_search").val());
				data.act = "Find_Task";
			    data.lowers = lowers==""?"0":lowers;
			    data.inout = inout==""?"all":inout;
			    data.state=state==""?"-1":state;
			}
			if(data.tableid==4)
			{
				var state = RUndefined($("#state_search").val());
				var type = RUndefined($("#type_search").val());
				data.act = "Find_Examine";
			    data.lowers = lowers==""?"0":lowers;
			    data.inout = inout==""?"all":inout;
			    data.state=state==""?"-1":state;
			    data.type = type==""?"-1":type;
			}
			if(data.tableid==5)
			{
				data.act = "Find_Notice";
			}
			if(data.tableid==25)
			{
				data.act = "Find_SignReport";
			}
			if(data.tableid==37)
			{
				data.act = "Find_Schedule";
			}
			data.userid=userid;
			data.comid=comid;
			data.pageindex=pageindex;
			data.source=source;
			data.ids=$(info).attr("ids");
			data.rids=$(info).attr("rids");
			data.pids=$(info).attr("pids");
			data.dids=$(info).attr("dids");
			if(data.ids=="")
			{
				data.pagesize=PAGE_SIZE10;
			}else{
				data.pagesize=data.ids.split(',').length;
			}
			data.sign=GetSign(data.act);
			
			request = mui.getJSON(index_domain, data, function(json) {
				if(json.data.list.length>0)
				{
					if(pageindex==1)
					{
						$("#contentlist1").html(eval(data.act.replace("Find_","")+ "_Data(json.data.list,data.tableid)"));
					}else{
						$("#contentlist1").append(eval(data.act.replace("Find_","")+ "_Data(json.data.list,data.tableid)"));
					}
					//$(eval(data.act.replace("Find_","")+ "_Data(json.data.list,data.tableid)")).insertBefore("#loading");
					setTimeout(function(){
						myScroll1.refresh();
						Animate_Vote();
						initPhotoSwipeFromDOM('.aimg');
					},500); //需要延迟500毫秒加载，否则当数量少时不能下拉
					if(json.data.list.length!=data.pagesize)
					{
						$("#loading1").html("");
					}else{
						if(data.ids!="")
						{
							$("#loading1").html("");
						}else{
							$("#loading1").html('<img src="img/loading.gif"/>');
						}
					}
				}else
				{
					
					if(pageindex==1)
					{
						$("#contentlist1").html("");
						$("#loading1").html("主人，没有找到您需要的数据");
					}else
					{
						$("#loading1").html("没有更多了");
					}
				}
         		$("#divmsg1").attr("pageindex",parseInt($("#divmsg1").attr("pageindex"))+1);
				//一级回复
				mui(".atool").off("tap",".reply");
				mui(".atool").off("tap",".delete");
				mui("#contentlist1").off("longtap",".sharelist");
				mui(".replylist").off("tap",".replyline");
				mui(".atool").on("tap",".reply",function() {
						var obj=$(this);
						var sharelist = $(this).parent().parent();
						var handle=$(this).attr("text");
						var tableid=sharelist.attr("tableid");
						var examinetab=$(this).attr("showtab");
						var html='<div style="height:auto;"><textarea id="replycontext" placeholder="' + handle + sharelist.attr("username")+'"></textarea>';
						if(tableid==3)
						{
							var identity=sharelist.attr("identity");
							var state=sharelist.attr("state");
							html+='<div class="comment"  identity="'+identity+'" style="width:100%;">';
							if(identity==1)
							{
								if(state==0 || state==3)
								{
								html+='<div class="score"><div><input id="five" name="taskstate" type="radio" value="0" onclick="Task_State(this)" checked="true"></div><label for="five" class="greens">普通回复</label></div>';
								html+='<div class="score"><div><input id="four" name="taskstate" type="radio" value="1" onclick="Task_State(this)"></div><label for="four">已完成，汇报结果</label></div>';
								}
							}
							if(identity==2)
							{
								if(state==0 || state==3)
								{
								html+='<div class="score"><div><input id="five" name="taskstate" type="radio" value="0" onclick="Task_State(this)" checked="true"></div><label for="five" class="greens">普通回复</label></div>';
								html+='<div class="score"><div><input id="three" name="taskstate" type="radio" value="2" onclick="Task_State(this)"></div><label for="three">取消任务</label></div>';
								}
								if(state==1)
								{
									html+='<div class="score"><div><input id="five" name="taskstate" type="radio" value="0" onclick="Task_State(this)" checked="true"></div><label for="five" class="greens">普通回复</label></div>';
									html+='<div class="score"><div><input id="two" name="taskstate" type="radio" value="3" onclick="Task_State(this)"></div><label for="two">不满意，继续执行</label></div>';
									html+='<div class="score"><div><input id="one" name="taskstate" type="radio" value="4" onclick="Task_State(this)"></div><label for="one">已完成，填写点评</label></div>';
									if(sharelist.find(".replyline[state=1]").length>0)
									{
										html=html.replace(handle + sharelist.attr("username"),handle+sharelist.find(".replyline[state=1]:last").attr("username"));
									}
								}
							}
							html+='</div>';
						}
						
						html+='<div class="mtool">'; 
						if(tableid==2 && handle=="批阅")
						{
							html+='<div class="comment"><div class="score"><div><input id="five" name="score" type="radio" value="5" onclick="Select_Score(this)"></div><label for="five">5分</label></div><div class="score"><div><input id="four" name="score" type="radio" value="4" onclick="Select_Score(this)"></div><label for="four">4分</label></div><div class="score"><div><input id="three" name="score" type="radio" value="3" checked="checked" onclick="Select_Score(this)"></div><label for="three" class="greens">3分</label></div><div class="score"><div><input id="two" name="score" type="radio" value="2" onclick="Select_Score(this)"></div><label for="two">2分</label></div><div class="score"><div><input id="one" name="score" type="radio" value="1" onclick="Select_Score(this)"></div><label for="one">1分</label></div></div>';
						}
						if(tableid==4 && examinetab=="show")
						{
							html+='<div class="comment"><div class="score"><div><input id="five" name="examinestate" type="radio" value="1" val="同意" checked="checked" onclick="Examine_State(this)"></div><label for="five"  class="greens">同意</label></div><div class="score"><div><input id="four" name="examinestate" type="radio" value="2" val="不同意" onclick="Examine_State(this)"></div><label for="four">不同意</label></div><div class="score"><div><input id="three" name="examinestate" type="radio" value="3" val="复议" onclick="Examine_State(this)"></div><label for="three">复议</label></div><div class="score"><div><input id="zero" name="examinestate" type="radio" value="0" val="回复" onclick="Examine_State(this)"></div><label for="zero">回复</label></div></div>';
							
						}
						html+='<div class="mbutton"><button id="reply" class="button blue right5">'+handle+'</button><button id="close" class="button gray right5">取消</button></div></div></div>';
						OpenMeng(html);
						get("reply").addEventListener("tap", function() {
							var data = {};
						    data.act = "Save_Reply";
						    data.sid = sharelist.attr("id");
						    data.parentid = 0 ;
						    data.tableid = tableid;
						    data.context = $("#replycontext").val();
						    data.userid = User.ID;
						    data.comid = User.ComID;
						    data.touserid = sharelist.attr("userid");
						    data.imgs = "";
						    data.source = source; 
						    data.version = version;
						    if(data.context.Trim()=="")
						    {
						    	plus.nativeUI.toast("请输入内容");
						    	return;
						    }
						    if (tableid == 2) //如果是日志
						    {
						        if (handle == "批阅") {
						            data.score = $(".comment").find("input[name='score']:checked").val();
						            data.state = 1;
						            //初始化按钮显示情况
						        }
						    }
						    if (tableid == 3) //如果是任务
						    {
						    	data.score = $(".comment").find("input[name='score']:checked").val();
						        data.state = $(".comment").find("input[name='taskstate']:checked").val();
						        var identity=sharelist.attr("identity");
								var state=sharelist.attr("state");
						        if(identity==2)
								{
									if(state==1)
									{
						       	 		data.touserid=sharelist.find(".replyline[state=1]:last").attr("userid");
						       	 		data.parentid=sharelist.find(".replyline[state=1]:last").attr("id");
						       	 	}
						       }
						    }
						    if (tableid == 4) //如果是审批
						    {
						    	data.state = $(".comment").find("input[name='examinestate']:checked").val();
						    	if (examinetab=="show") {
						            data.last_examineuser = sharelist.find(".examineflow .flow .line:last").attr("val"); //获取最后一个审批人，用于是否改变审批状态
						       }
						    }
						    data.sign=GetSign(data.act);
						    CloseMeng();
						    mui.getJSON(index_domain, data, function(json) {
						    	var reply=json.data;
								if (json.state) {
									try{
									json.data.Context=decodeURI(json.data.Context);
									}catch(e){}
									if(sharelist.find(".replylist").length==0) //如果没有回复，则追加回复容器
									{
										sharelist.append('<div class="replylist"></div>');
									}
									if(handle=="批阅")
									{
										sharelist.find(".aname font").attr("class","greens").html("已批阅");
										obj.attr("text","回复");
										Init_Notice2();
									}
									if(tableid==3)
									{
										if (data.state == 1) {
											sharelist.find(".aname font").html("待检");
											sharelist.attr("state","1");
										}
										if (data.state == 2) {
											sharelist.find(".aname font").html("已取消");
											sharelist.attr("state","2");
										}
										if (data.state == 3) {
											sharelist.find(".aname font").html("继续执行");
											sharelist.attr("state","3");
										}
										if (data.state == 4) {
											sharelist.find(".aname font").html("已完成").attr("class","greens");
											sharelist.attr("state","4");
											Init_Notice2();
										}
									}
									if(tableid==4)
									{
										if (!sharelist.find(".comment").hasClass("hidden")) {
								           	
								            if (data.last_examineuser == User.ID && data.state==1) {
								                sharelist.find(".aname font").html("已同意").attr("class","greens");
								                sharelist.find(".reply").attr("showtab","hidden");
								                Init_Notice2();
								            }
								            if(data.state==2){
								            	sharelist.find(".aname font").html("不同意").attr("class","reds");
								            }
								            if(data.state==3){
								            	sharelist.find(".aname font").html("复议").attr("class","reds");
								            }
								            if (examinetab=="show" && data.state==1) { 
								            	sharelist.find(".line[val='"+User.ID+"']").html('<div class="success"></div>');
								            }
								        }
									}
									if(data.parentid==0)
									{
										sharelist.find(".replylist").append('<div class="replyline" id="'+reply.ID+'" userid="'+reply.UserID+'" username="'+reply.UserName+'" sid="'+reply.SID+'" parentid="'+reply.ParentID+'"><font>'+User.RealName+'：</font>'+json.data.Context+'</div>');
									}else
									{
										sharelist.find(".replylist").append('<div class="replyline" id="'+reply.ID+'" userid="'+reply.UserID+'" username="'+reply.UserName+'" sid="'+reply.SID+'" parentid="'+reply.ParentID+'"><font>'+User.RealName+'</font>回复<font>'+sharelist.find(".replyline[state=1]:last").attr("username")+'：</font>'+json.data.Context+'</div>');
									}
						            plus.nativeUI.toast("回复成功");
						            
						            
						        } else {
						            
						        }
							});
					}); 
				});
				//删除OA
				mui(".atool").on("tap",".delete",function() {
						var sharelist = $(this).parent().parent();
							var data = {};
						    data.id = sharelist.attr("id");
						    data.tableid = parseInt(sharelist.attr("tableid"));
						    data.act = "Delete_OA";
						    data.source = source; 
						    data.version = version;
						    data.userid=userid;
							data.comid=comid;
							data.sign=GetSign(data.act);
						    var tablename = Get_Model(data.tableid);
						    plus.nativeUI.confirm("确定要删除该"+tablename+"吗？", function(event){
							if(event.index==1)
							{ 
								mui.getJSON(index_domain, data, function(json) {
									if (json.state) {
										sharelist.hide(500);
							            plus.nativeUI.toast("删除成功");
							            FindOAReport();
							        } else {
							            plus.nativeUI.toast("删除失败");
							        }
								});
							}
							},"提示", ["取消","确认"]); 
						    
				});
				//删除OA
				mui("#contentlist1").on("longtap",".sharelist",function() {
					var sharelist = $(this);
					if(userid==sharelist.attr("userid"))
					{
							var data = {};
						    data.id = sharelist.attr("id");
						    data.tableid = parseInt(sharelist.attr("tableid"));
						    data.act = "Delete_OA";
						    data.source = source; 
						    data.version = version;
						    data.userid=userid;
							data.comid=comid;
							data.sign=GetSign(data.act);
						    var tablename = Get_Model(data.tableid);
						    plus.nativeUI.confirm("确定要删除该"+tablename+"吗？", function(event){
							if(event.index==1)
							{ 
								mui.getJSON(index_domain, data, function(json) {
									if (json.state) {
										sharelist.hide(500);
							            plus.nativeUI.toast("删除成功");
							            FindOAReport();
							        } else {
							            plus.nativeUI.toast("删除失败");
							        }
								});
							}
							},"提示", ["取消","确认"]); 
					}
				});
				//二级回复
				mui(".replylist").on("tap",".replyline",function() {
					var replylist = $(this);
						if(userid+""!=replylist.attr("userid"))
						{
							var sharelist = $(this).parent().parent();
							var tableid=sharelist.attr("tableid");
							var examinetab=sharelist.find(".reply").attr("showtab");
							var html='<div style="height:200px;"><textarea id="replycontext" placeholder="回复'+replylist.attr("username")+'"></textarea>';
							if(tableid==3)
							{
								var identity=sharelist.attr("identity");
								var state=sharelist.attr("state");
								html+='<div class="comment"  identity="'+identity+'" style="width:100%;">';
								
								if(identity==1)
								{
									if(state==0 || state==3)
									{
									html+='<div class="score"><div><input id="five" name="taskstate" type="radio" value="0" onclick="Task_State(this)" checked="true"></div><label for="five" class="greens">普通回复</label></div>';
									html+='<div class="score"><div><input id="four" name="taskstate" type="radio" value="1" onclick="Task_State(this)"></div><label for="four">已完成，汇报结果</label></div>';
									}
								}
								if(identity==2)
								{
									if(state==0 || state==3)
									{
									html+='<div class="score"><div><input id="five" name="taskstate" type="radio" value="0" onclick="Task_State(this)" checked="true"></div><label for="five" class="greens">普通回复</label></div>';
									html+='<div class="score"><div><input id="three" name="taskstate" type="radio" value="2" onclick="Task_State(this)"></div><label for="three">取消任务</label></div>';
									}
									if(state==1)
									{
									html+='<div class="score"><div><input id="five" name="taskstate" type="radio" value="0" onclick="Task_State(this)" checked="true"></div><label for="five" class="greens">普通回复</label></div>';
									html+='<div class="score"><div><input id="two" name="taskstate" type="radio" value="3" onclick="Task_State(this)"></div><label for="two">不满意，继续执行</label></div>';
									html+='<div class="score"><div><input id="one" name="taskstate" type="radio" value="4" onclick="Task_State(this)"></div><label for="one">已完成，填写点评</label></div>'; 
									}
								}
								html+='</div>';
							}
							html+='<div class="mtool">';
							if(tableid==4 && examinetab=="show")
							{
								html+='<div class="comment"><div class="score"><div><input id="five" name="examinestate" type="radio" value="1" val="同意" checked="checked" onclick="Examine_State(this)"></div><label for="five"  class="greens">同意</label></div><div class="score"><div><input id="four" name="examinestate" type="radio" value="2" val="不同意" onclick="Examine_State(this)"></div><label for="four">不同意</label></div><div class="score"><div><input id="three" name="examinestate" type="radio" value="3" val="复议" onclick="Examine_State(this)"></div><label for="three">复议</label></div><div class="score"><div><input id="zero" name="examinestate" type="radio" value="0" val="回复" onclick="Examine_State(this)"></div><label for="zero">回复</label></div></div>';
							}
							html+='<div class="mbutton"><button id="reply" class="button blue right5">回复</button><button id="close" class="button gray right5">取消</button></div></div></div>';
							OpenMeng(html);
							get("reply").addEventListener("tap", function() {
								var data = {};
							    data.act = "Save_Reply";
							    data.sid = replylist.attr("sid");
							    data.parentid = replylist.attr("parentid");
							    if(data.parentid==0)
							    {
							    	data.parentid=replylist.attr("id");
							    }
							    data.tableid = replylist.attr("tableid");
							    data.context = $("#replycontext").val();
							    data.userid = User.ID;
							    data.comid = User.ComID;
							    data.touserid = replylist.attr("userid");
							    data.imgs = "";
							    data.source = source;  
							    data.version = version;
							    if(data.context.Trim()=="")
							    {
							    	plus.nativeUI.toast("请输入内容");
							    	return;
							    }
							    if (tableid == 3) //如果是任务
							    {
							    	data.score = $(".comment").find("input[name='score']:checked").val();
							        data.state = $(".comment").find("input[name='taskstate']:checked").val();
							    }
							    if (tableid == 4) //如果是审批
							    {
							    	data.state = $(".comment").find("input[name='examinestate']:checked").val();
							    	if (examinetab=="show") {
							            data.last_examineuser = sharelist.find(".examineflow .flow .line:last").attr("val"); //获取最后一个审批人，用于是否改变审批状态
							       }
							    }
							    data.sign=GetSign(data.act);
							    CloseMeng();
							    mui.getJSON(index_domain, data, function(json) {
							    	var reply=json.data;
									if (json.state) {
										replylist.parent().append('<div class="replyline" id="'+reply.ID+'" userid="'+reply.UserID+'" username="'+reply.UserName+'" sid="'+reply.SID+'" parentid="'+reply.ParentID+'"><font>'+User.RealName+'</font>回复<font>'+replylist.attr("username")+'：</font>'+json.data.Context+'</div>');
							            plus.nativeUI.toast("回复成功");
							            if(tableid==3)
										{
											if (data.state == 1) {
												sharelist.find(".aname font").html("待检");
												sharelist.attr("state","1");
											}
											if (data.state == 2) {
												sharelist.find(".aname font").html("已取消");
												sharelist.attr("state","2");
											}
											if (data.state == 3) {
												sharelist.find(".aname font").html("继续执行");
												sharelist.attr("state","3");
											}
											if (data.state == 4) {
												sharelist.find(".aname font").html("已完成").attr("class","greens");
												sharelist.attr("state","4");
												Init_Notice2();
											}
										}
										if(tableid==4)
										{
											if (!sharelist.find(".comment").hasClass("hidden")) {
									           	
									            if (data.last_examineuser == User.ID && data.state==1) {
									                sharelist.find(".aname font").html("已同意").attr("class","greens");
									                sharelist.find(".reply").attr("showtab","hidden");
									                Init_Notice2();
									            }
									            if(data.state==2){
									            	sharelist.find(".aname font").html("不同意").attr("class","reds");
									            }
									            if(data.state==3){
									            	sharelist.find(".aname font").html("复议").attr("class","reds");
									            }
									            if (examinetab=="show" && data.state==1) {
									            	sharelist.find(".line[val='"+User.ID+"']").html('<div class="success"></div>');
									            }
									        }
										}
							            
							        } else {
							            
							        }
							        
								});
							});
						}else
						{
							var data = {};
							data.id = replylist.attr("id");
							data.ids = data.id;
						    data.sid = replylist.attr("sid");
						    data.tableid = replylist.attr("tableid");
						    data.act = "Delete_Reply";
						    data.source = source; 
						    data.version = version;
						    data.userid=userid;
							data.comid=comid;
							data.sign=GetSign(data.act);
						    var tablename = Get_Model(data.tableid);
						    plus.nativeUI.confirm("确定要删除该回复吗？", function(event){
							if(event.index==1)
							{ 
								mui.getJSON(index_domain, data, function(json) {
									if (json.state) {
										replylist.hide(500);
							            plus.nativeUI.toast("删除成功");
							        } else {
							            plus.nativeUI.toast("删除失败");
							        }
								}); 
							}
							},"提示", ["取消","确认"]); 
						}
					});
					
			});
};
function Select_Score(o) {
    $(o).parent().parent().parent().find("label").removeClass("greens");
    $(o).parent().next().addClass("greens");
};
function Notice_Data(data,tableid) {
	var buffer = new StringBuffer();
	$(data).each(function(i,info){
		try{
		info.Context=decodeURI(info.Context);
		}catch(e){}
		buffer.append('<div class="sharelist border-bottom" tableid="'+tableid+'" id="'+info.ID+'" userid="'+info.UserID+'" username="'+info.RealName+'">');
		buffer.append('<div class="atitle">');
		buffer.append('<div class="aimg"><img src="'+info.HeadImg+'"/></div>');
		buffer.append('<div class="aname">'+info.RealName+'</div>');
		buffer.append('<div class="adate">'+info.CreateTime+'  &nbsp;&nbsp;&nbsp;&nbsp; 来自&nbsp;'+info.Version+'</div>');
		buffer.append('<div class="atag">公告</div>');
		buffer.append('</div>');
		buffer.append('<div class="asendrange">发送给：<font>'+info.ToUsers+'</font></div>');
		buffer.append('<div class="aimg">');
		$(info.Imgs).each(function(k,img)
		{
		var right=k%3==2?0:5;
		buffer.append('<figure class="asquare" style="width:'+(swidth-30)/3+'px; heigth:'+(swidth-30)/3+'px; margin-right:'+right+'px; float:left; display:block;" itemscope itemtype="http://schema.org/ImageObject"><a src="'+img.Img1000+'" itemprop="contentUrl" data-size="'+img.Width+'x'+img.Height+'"><img src="' + img.Img200 + '" width="'+(swidth-30)/3+'" height="'+(swidth-30)/3+'" itemprop="thumbnail" alt="Image description"/></a></figure>');
		});
		buffer.append('</div>');
		buffer.append('<div class="atopic">'+info.Title+'</div>');
		buffer.append('<div class="acontent"><span>' + info.Context + '</span><div id="detail">'+info.Context.DHtml().Cut()+'</div></div>');
		if(info.Address!=""){
		buffer.append('<div class="aposition"><div class="icon"><img src="img/position2.png" height="22"/></div><div class="address">'+info.Address+'</div></div>');
		}
		buffer.append('<div class="atool">');
		if(info.UserID==userid){
		buffer.append('<div class="delete"><img src="img/delete.png" height="12"/></div>');
		}
		buffer.append('<div class="reply" text="回复"><img src="img/replyes.png" height="12"/></div></div>');
		if(info.ReplyList.length>0)
		{
			buffer.append('<div class="replylist">');
			$(info.ReplyList).each(function(i,reply){
				try{
				reply.Context=decodeURI(reply.Context);
				}catch(e){}
				if(reply.ParentID==0)
				{
					buffer.append('<div class="replyline" id="'+reply.ID+'" userid="'+reply.UserID+'" tableid="'+tableid+'" username="'+reply.UserName+'" sid="'+info.ID+'" parentid="'+reply.ParentID+'"><font>'+reply.UserName+'：</font>'+reply.Context+'</div>');
				}else{
					buffer.append('<div class="replyline" id="'+reply.ID+'" userid="'+reply.UserID+'" tableid="'+tableid+'" username="'+reply.UserName+'" sid="'+info.ID+'" parentid="'+reply.ParentID+'"><font>'+reply.UserName+'</font>回复<font>'+reply.ToUserName+'：</font>'+reply.Context+'</div>');
				}
			});
			buffer.append('</div>');
		}
		buffer.append('</div>');
	});
	return buffer.toString();
};